<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Spiskovi</title>
        <h:outputStylesheet library="css" name="styles.css"/> 
    </h:head>
    <h:body>
        <ui:include src="profMenuBar.xhtml"/>
        <h:form>
            <p:panel id="spiskovi" header="Izmeni spisak" styleClass="headerPanel">
                <h:outputLabel value="Predmet: "/> 
                <p:selectOneMenu value="#{profBean.selectedP}" var="p" converter="courseConverter">
                    <f:selectItems value="#{profBean.PList}" var="predmet" itemLabel="#{predmet.naziv} - #{predmet.sifra}" itemValue="#{predmet}"/>
                    <p:ajax event="change" listener="#{profBean.postaviL()}" update="spiskovi"/>
                    <p:column>
                        #{p.naziv} - #{p.sifra}
                    </p:column>
                </p:selectOneMenu> <br/><br/>

                <h:outputLabel value="Spisak: "/> 
                <p:selectOneMenu value="#{profBean.selectedL}" var="l" converter="listConverter">
                    <f:selectItems value="#{profBean.toList(profBean.selectedListList)}" var="spisak" itemLabel="#{spisak.naziv}" itemValue="#{spisak}"/>
                    <p:ajax event="change" update="spiskovi2"/>
                    <p:column>
                        #{l.naziv}
                    </p:column>
                </p:selectOneMenu>

                <p:panel    id="spiskovi2">
                    <p:panelGrid columns="2">
                        <h:outputLabel value="Naziv:"/>
                        <p:inputText value="#{profBean.selectedL.naziv}"/>

                        <h:outputLabel value="Termin:"/>
                        <p:inputText value="#{profBean.selectedL.termin}"/>

                        <h:outputLabel value="Mesto:"/> 
                        <p:inputText value="#{profBean.selectedL.mesto}"/> 

                        <h:outputLabel value="Limit:"/> 
                        <p:panel>
                            <p:inputText id="limit" value="#{profBean.selectedL.ogranicenje}" style="margin-bottom:   5px"/><br/>
                            <p:slider for="limit" minValue="0" maxValue="200" />
                        </p:panel>
                        <h:outputText value="Zakljucan: " />  
                        <p:selectBooleanCheckbox  value="#{profBean.selectedL.zakljucan}"/> 

                        <p:commandButton value="Izmeni" action="#{profBean.updateList()}" ajax="false" style="margin: auto; margin-left: 100px;"/>
                    </p:panelGrid>
                </p:panel>
            </p:panel>
        </h:form>
    </h:body>
</html>

